/**
 * 练习4： 使用Maybe重写ex4,不要有if语句
 */

const fp = require('lodash/fp')
const { Maybe, Container } = require('./support')

// let ex4 = function(n) {
//   if(n) {
//     return parseInt(n)
//   }
// }

const ex4 = function(n) {
  return Maybe.of(n).map(n => n)
}

console.log(ex4(1)) // Maybe { _value: 1 }
console.log(ex4(null)) // Maybe { _value: null }


